package com.yingside.game;

public abstract class Enemy {
    private String name;
    private int hp;
    private int attack;
    private int defence;
    private int money;
    /**
     * 敌人受伤的方法
     * @param h 英雄对象
     */
    public void injured(Hero h){
        int lostLife = h.getAttack() - this.defence;
        if(lostLife < 1){
            lostLife = 1; //至少减1滴血
        }
        System.out.println("==================" + this.name + " 受伤了==================");
        System.out.println("嗷嗷嗷~~~");
        System.out.println("减少血量:" + lostLife);
        this.hp -= lostLife;

        System.out.println("剩余血量:" + this.hp);
        System.out.println("==================" + this.name + " 受伤了==================");
    }

    public abstract void response(Hero h);

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getHp() {
        return hp;
    }

    public void setHp(int hp) {
        this.hp = hp;
    }

    public int getAttack() {
        return attack;
    }

    public void setAttack(int attack) {
        this.attack = attack;
    }

    public int getDefence() {
        return defence;
    }

    public void setDefence(int defence) {
        this.defence = defence;
    }

    public int getMoney() {
        return money;
    }

    public void setMoney(int money) {
        this.money = money;
    }
}
